FROM openjdk:17-jdk-slim

WORKDIR /app

COPY target/mall-gateway-1.0.0.jar app.jar

EXPOSE 8000

# SkyWalking Agent配置
ENV SW_AGENT_NAME=mall-gateway
ENV SW_AGENT_COLLECTOR_BACKEND_SERVICES=skywalking-oap:11800

# 添加SkyWalking Agent
RUN mkdir -p /agent
ADD skywalking-agent /agent

# 设置时区
ENV TZ=Asia/Shanghai

ENTRYPOINT ["java", \
    "-javaagent:/agent/skywalking-agent.jar", \
    "-Dskywalking.agent.service_name=${SW_AGENT_NAME}", \
    "-Dskywalking.collector.backend_service=${SW_AGENT_COLLECTOR_BACKEND_SERVICES}", \
    "-Xms256m", \
    "-Xmx512m", \
    "-Djava.security.egd=file:/dev/./urandom", \
    "-jar", "/app/app.jar" \
] 